package com.qf.jvm;

/**
 *   演示内存溢出
 * @author lixu
 */
public class OOMDemo {

    public static void main(String[] args) {
        //1:栈内存溢出  保存的是方法中数据 ==
        //OOMDemo oomDemo = new OOMDemo();
        //oomDemo.a();
        // Exception in thread "main" java.lang.StackOverflowError
        //2:堆内存溢出     JVM 参数调优 -Xmx50m -Xms50m
        byte[] b = new byte[60 * 1024 * 1024];
        // Exception in thread "main" java.lang.OutOfMemoryError: Java heap space


    }
    public void a(){
        b();
    }
    public void b(){
        a();
    }
}
